package cadc.ping;


import cadc.actions.UserAction;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class UserLoggedinInterceptor extends AbstractInterceptor {

	private static final long serialVersionUID = -971525102379628571L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		UserAction  action = (UserAction)invocation.getAction();
		if(action.getAccount().isLoggedin()){
			return invocation.invoke();
		}else{
			action.addActionError("您进行的操作需要先登录");
			return Action.LOGIN;
		}
	}

}
